iOS 图片编辑——涂鸦——在图片上添加文字

前面几节讲了图片上画线

这一节 我们简单讲一讲 给图片上添加文字的方法 我们继续使用上节的代码(代码下载地址见上节末尾   http://blog.csdn.net/lwjok2007/article/details/50887396

首先我们将添加文字的View单独抽象出现实现

创建一个类 继承自UIView

起名: AddText

定义一个协议 当输入完成之后 将内容返回给ViewController

#import <UIKit/UIKit.h>


@protocol EditTextDelegate <NSObject>

-(void)ADDTextWithText:(NSString *)TEXT;

@end


@interface AddText : UIView


@property(nonatomic,strong)id<EditTextDelegate>delegate;

@end


实现AddText

#import "AddText.h"

@implementation AddText


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.userInteractionEnabled = YES;
        self.backgroundColor = [UIColor whiteColor];
        [self initUserInterface];
    }
    return self;
}

//添加控件
- (void)initUserInterface{
    //取消按钮
    UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom];
    btnCancel.frame = CGRectMake(5, 5, 60, 30);
    [btnCancel setTitleColor:[UIColor blackColor] forState:UIControlStateN
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值